package com.ftg.learn.bus.sharecaruse_record.controller;

import com.ftg.learn.bus.sharecaruse_record.entity.SharecarUseRecord;
import com.ftg.learn.bus.sharecaruse_record.service.SharecarUseRecordService;
import com.ftg.learn.bus.util.ResultType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(value = "公车操作记录",tags = "公车操作记录")
public class SharecarUseRecordController {

    @Autowired
    SharecarUseRecordService scurs;

    @ApiOperation(value = "公车操作记录表")
    @GetMapping("/showcaruse")
    public List<SharecarUseRecord> showAll(){
        return scurs.showAll();
    }

    @ApiOperation(value = "删除单条操作记录")
    @DeleteMapping("/deletecaruse")
    public int delete(String id){
        return scurs.delete(id);
    }

    @ApiOperation(value = "查一条操作记录")
    @PutMapping("/carusefindone/{id}")
    public SharecarUseRecord findOne(@ApiParam("用车记录id") @PathVariable String id){
        return scurs.findOne(id);
    }

    @GetMapping("/showcaruse/modify&limit/{page}&{limit}&{sharecar_use_id}&{sharecar_use_operater}")
    @ApiOperation("模糊查询与分页")
    public ResultType<SharecarUseRecord> query(@ApiParam("总页数") @PathVariable int page, @ApiParam("每页条数") @PathVariable int limit, @ApiParam("用车记录id") @PathVariable String sharecar_use_id, @ApiParam("操作人") @PathVariable String sharecar_use_operater) {
        return scurs.query(page,limit,sharecar_use_id,sharecar_use_operater);
    }
}
